package com.artist.controller;

import com.artist.entity.TbWorking;
import com.artist.service.WorkingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@Api(tags = "工作室简介管理")
@Controller
public class WorkingController {
    @Autowired
    private WorkingService workingService;

    @ApiOperation(value = "工作室简介列表")
    @GetMapping("/working")
    @ResponseBody
    public List<TbWorking> getAllWorking(){
        return workingService.selectAll();
    }

    @ApiOperation(value = "单个工作室简介")
    @GetMapping("/working/{id}")
    @ResponseBody
    public  TbWorking getWorkingByPrimaryKey(@PathVariable Long id){
        return workingService.selectWorkingByPrimaryKey(id);
    }

    @ApiOperation(value = "新增工作室简介")
    @PostMapping("/working")
    public void insertWorking(@RequestBody TbWorking tbWorking){
        workingService.savaWorking(tbWorking);

    }

    @ApiOperation(value = "编辑工作室简介")
    @PutMapping("/working/{id}")
    public void putWorkingById(@RequestBody TbWorking tbWorking){
        workingService.updateWorkingByPrimaryKeySelective(tbWorking);
    }

    @ApiOperation(value = "删除工作室简介")
     @DeleteMapping("/working/{id}")
    public void deleteWorkingById(@PathVariable Long id){
        workingService.deleteWorkingByPrimaryKey(id);
     }

}
